#ifndef FOLDERCOPIER_H
#define FOLDERCOPIER_H

#include <QObject>
#include <QDir>
#include <QFileInfo>
#include <QDebug>

class FolderCopier : public QObject
{
    Q_OBJECT
public:
    QTextStream *myLog;

    QString driveLetter;
    QString pathSource;
    QString pathDest;
    void setDriveLetter(QString &letter);
    void setDriveLetter(const char *letter);
    void setPathSource(QString &path);
    void setPathSource(const char *path);
    void setPathDest(QString &path);
    void setPathDest(const char *path);
    QString getPathDest();
    void startCopy();
    void stopCopy();

    int getProgress();

    explicit FolderCopier(QObject *parent = 0);
private:
    void calculateTotalSize(const QString &path);
    void copyFolders(const QString &path);
    void removeFolders(const QString &path);
    void copyFile(const QString &source,const QString &to);

    qint64 totalSize;
    qint64 totalSizeCopied;
    bool _stoped;

signals:
    void finishCopy();
    void stopedCopy();
public slots:
    void onWrite(qint64);
    
};

#endif // FOLDERCOPIER_H
